<template>
	<view class="content">
		<!-- 图片 -->
		<view>
			<view class="ipts">
				<view class="record">
					<view class="">
						<image src="/static/jilu.png" mode=""></image>
						<span>用户信息</span>
					</view>
				</view>
				<!-- 户号 -->
				<view class="info-item">
					<view class="info-item-left">
						<view class="dot"></view>
						<span>档案号</span>
					</view>
					<span class="place-class">A01978888888888</span>
				</view>
				
				<!-- 户主姓名 -->
				<view class="info-item">
					<view class="info-item-left">
						<view class="dot"></view>
						<span>户主姓名</span>
					</view>
					<span class="place-class">孙铁镑</span>
				</view>
				
				<!-- 身份证号 -->
				<view class="info-item">
					<view class="info-item-left">
						<view class="dot"></view>
						<span>身份证号</span>
					</view>
					<span class="place-class">133026196600000000</span>
				</view>
				
				<!-- 联系方式 -->
				<view class="info-item">
					<view class="info-item-left">
						<view class="dot"></view>
						<span>联系方式</span>
					</view>
					<view class="" style="display: flex;align-items: center;">
						<image src="/static/pagesB/tel.png" mode=""></image>
						<span class="place-class">13888888888</span>
					</view>
				</view>
				
				<!-- 地址 -->
				<view class="info-item">
					<view class="info-item-left">
						<view class="dot"></view>
						<span>地址</span>
					</view>
					<span class="place-class">武强县街关镇康庄村81号</span>
				</view>
			</view>
			<!-- 第二块 -->
			<view class="ipts">
				<!-- 气表清零原因 -->
				<view class="info-item">
					<view class="info-item-left">
						<view class="dot"></view>
						<span>气表清零原因</span>
					</view>
					<input class="item-ipt" type="text" value="" placeholder="原因" />
				</view>
				
				<!-- 气表品牌 -->
				<view class="info-item">
					<view class="info-item-left">
						<view class="dot"></view>
						<span>气表品牌</span>
					</view>
					<input class="item-ipt" type="text" value="" placeholder="品牌" />
				</view>
				
				<!-- 气表号 -->
				<view class="info-item">
					<view class="info-item-left">
						<view class="dot"></view>
						<span>气表号</span>
					</view>
					<input class="item-ipt" type="text" value="" placeholder="3245" />
				</view>
				
				<!-- 原气表读数 -->
				<view class="info-item">
					<view class="info-item-left">
						<view class="dot"></view>
						<span>原气表读数</span>
					</view>
					<input class="item-ipt" type="text" value="" placeholder="324" />
				</view>
				
				<!-- 原气表剩余气量/金额 -->
				<view class="info-item">
					<view class="info-item-left">
						<view class="dot"></view>
						<span>原气表剩余气量/金额</span>
					</view>
					<input class="item-ipt" type="text" value="" placeholder="321元" />
				</view>
				
				<!-- 气表进气方向 -->
				<view class="info-item">
					<view class="info-item-left">
						<view class="dot"></view>
						<span>气表进气方向</span>
					</view>
					<input class="item-ipt" type="text" value="" placeholder="方向" />
				</view>
				
				<!-- 气表照片 -->
				<view class="info-item">
					<view class="info-item-left">
						<view class="dot"></view>
						<span>气表照片</span>
					</view>
					<image style="width: 70rpx;height: 70rpx;" src="/static/pagesB/qibiao.png" mode=""></image>
				</view>	
			</view>
			<!-- 跟踪记录 -->
			<view class="ipts">
				<!-- 历史安检 -->
				<view class="record">
					<view class="">
						<image src="/static/jilu.png" mode=""></image>
						<span>历史清零记录</span>
					</view>
					<view class="right">
							<input @input="searChange" v-model="searchIpt" type="text" value="" placeholder="请输入"
								placeholder-class="plac-class" />
							<image src="/static/search1.png" mode="" @click="searNum"></image>
					</view>
				</view>
				<!-- 联系人 -->
				<view class="liaison">
					<view class="left">
						<view class="shuxian"></view>
						<view class="name">李忠育</view>
						<view class="time">2020.07.24</view>
					</view>
					<view class="right">
						<image src="/static/pagesB/tel.png" mode=""></image>
						<view class="phone">13999999999</view>
						<image src="/static/xia.png" mode=""></image>
					</view>
				</view>
			</view>
		</view>
		<cpimg ref="cpimg" @result="cpimgOk" @err="cpimgErr" :number="1" :fixOrientation="true" :size="500"
			:maxWidth="800" :ql="0.7" type="url" />

	</view>
</template>

<script>
	import cpimg from "@/components/cpimg/cpimg.vue"
	import easySelect from '@/components/easy-select/easy-select'
	export default {
		components: {
			easySelect,
			cpimg
		},
		data() {
			return {
				index: 0,
				ret: '',
				mysearchIpt: false,
				searchIpt: '',
				searchIpts: '',
				flag: true,
				token: '',
				last_check: {},
				user_info: {},
				textNumber: 0,
				// 品牌数组
				options: [],
				// 功率数组
				options1: [],
				// 品牌id
				brandId: '',
				// 功率id
				powerId: '',
				// 备注
				autoText: '',
				// 气表底数
				meter_base_num: '',
				// 默认显示品牌名
				brandName: '',
				// 默认显示功率
				powerName: '',
				// 气表照片地址
				fileImg1: '',
				img1: '',

				fileImg2: [],
				img2: [],

				fileImg3: [],
				img3: [],
				fileImg4: '',
				img4: '',
				// 是否安检
				isChecked: true,
				isCheckedNum: '',
				// 是否签收
				isChecked1: true,
				isCheckedNum1: '',
				// 是否派发
				isChecked2: true,
				isCheckedNum2: '',
				showRecord: true,
				marginBotton1: 100 + 'rpx',
				danger_id: ''
			}
		},
		onShow() {
		},
		onLoad() {
		},
		methods: {
			//图片删除
			updetail(type, index) {
				this.img1 = ''
			},
			updetail2(index) {
				this.img2.splice(index, 1)
			},
			updetail3(index) {
				this.img3.splice(index, 1)
			},
			updetail4(index) {
				this.img4 = ""
			},
			//图片预览
			seeimg(img) {
				uni.previewImage({
					urls: [img],
					longPressActions: {
						itemList: [],
						success: function(data) {
							console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
						},
						fail: function(err) {
							console.log(err.errMsg);
						}
					}
				});
			},

			// 选择气表照片

			changeImg(ret) {
				var that = this;
				that.ret = ret
				that.$refs.cpimg._changImg()

			},
			cpimgOk(file) {
				let that = this
				var ret = that.ret
				uni.showLoading({
					title: '上传中...'
				})
				uni.uploadFile({
					url: that.$fileImg + '/common/upload',
					filePath: file[0],
					name: 'file',
					formData: {
						token: that.token
					},
					success(res1) {
						let dataPath = JSON.parse(res1.data)
						if (dataPath.code == 1) {
							if (ret == '燃气表') {
								that.fileImg1 = dataPath.data.url
								that.img1 = file[0]
								// console.log(111)
							}
							if (ret == '燃气火点') {
								that.fileImg2.push(dataPath.data.url)
								that.img2.push(file[0])
							}
							if (ret == '资料') {
								that.fileImg3.push(dataPath.data.url)
								that.img3.push(file[0])
							}
							if (ret == '其他') {
								that.fileImg4 = dataPath.data.url
								that.img4 = file[0]
							}
						}
						uni.hideLoading()
					},
					fail: () => {
						uni.hideLoading()
						uni.showToast({
							title: '上传失败'
						})
					}
				});


			},

			cpimgErr(e) {
				uni.showToast({
					title: '上传失败',
					icon: 'none'
				})
				console.log(e)
			},
			danger() {

				if (this.img1 != '') {
					uni.setStorage({
						key: 'img1',
						data: this.img1
					})
				}

				if (this.img2.length > 0) {
					uni.setStorage({
						key: 'img2',
						data: this.img2
					})
				}

				if (this.img3.length > 0) {
					uni.setStorage({
						key: 'img3',
						data: this.img3
					})
				}

				if (this.img4 != '') {
					uni.setStorage({
						key: 'img4',
						data: this.img4
					})
				}

				if (this.autoText != '') {
					uni.setStorage({
						key: 'bztext',
						data: this.autoText
					})
				}


				uni.navigateTo({
					url: '../securityCheck/dangerReport?id=' + this.last_check.member_id + '&type=' + '5' +
						'&socont=' + this.searchIpt
				})

			},
			close() {
				uni.navigateTo({
					url: '../index/index'
				})
				uni.removeStorage({
					key: 'img1'
				})
				uni.removeStorage({
					key: 'img2'
				})
				uni.removeStorage({
					key: 'img3'
				})
				uni.removeStorage({
					key: 'img4'
				})
				uni.removeStorage({
					key: 'bztext'
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.content {

		.ipts {
			background-color: #fff;
			margin-bottom: 20rpx;

			.liaison {
				display: flex;
				align-items: center;
				justify-content: space-between;
				padding: 0rpx 32rpx;
				height: 100rpx;
				align-items: center;

				.left {
					display: flex;
					align-items: center;

					.shuxian {
						width: 8rpx;
						height: 28rpx;
						background: #003690;
						opacity: 1;
						border-radius: 200rpx;
						margin-right: 10rpx;
					}

					.name {
						font-size: 28rpx;
						font-family: Source Han Sans SC;
						font-weight: 500;
						color: #333333;
						margin-right: 10rpx;
					}

					.time {
						font-size: 24rpx;
						font-family: Source Han Sans SC;
						font-weight: 400;
						color: #777777;
					}
				}

				.right {
					display: flex;
					align-items: center;

					image {
						width: 32rpx;
						height: 32rpx;
						margin-right: 10rpx;
					}

					.phone {
						font-size: 24rpx;
						font-family: Source Han Sans SC;
						font-weight: 400;
						color: #555555;
					}
				}
			}
		}

		.info-item {
			box-sizing: border-box;
			display: flex;
			align-items: center;
			justify-content: space-between;
			// height: 72rpx;
			width: 100%;
			height: 100rpx;
			padding: 0rpx 32rpx;
			align-items: center;
			background-color: #fff;
			font-size: 24rpx;
			color: #333;
			border-bottom: 1rpx solid #DDDDDD;
			
			image {
				width: 32rpx;
				height: 32rpx;
			}

			input {
				flex: 1;
				text-align: right;
			}

			.dot {
				width: 8rpx;
				height: 8rpx;
				background-color: #003690;
				border-radius: 50%;
				margin-right: 10rpx;
			}

			.danger-img {
				position: relative;
				display: flex;
				align-items: center;

				.updeletes {
					position: absolute;
					top: -20rpx;
					right: -20rpx;
					width: 40rpx;
					height: 40rpx;
					display: flex;
					align-items: center;
					justify-content: center;
					z-index: 88;

					image {
						width: 100%;
						height: 100%;
					}
				}
			}

			.info-item-left {
				display: flex;
				align-items: center;
				font-size: 28rpx;
			}
		}

		.hengxian {
			width: 700rpx;
			height: 2rpx;
			background-color: #eee;
			margin: 20rpx auto;
		}

		.place-class {
			font-size: 28rpx;
			color: #999;
		}
		.item-ipt{
			width: 400rpx;
			text-align: end;
			font-size: 28rpx;
		}

		.btn {
			width: 646rpx;
			height: 80rpx;
			margin: 74rpx auto;
			text-align: center;
			line-height: 80rpx;
			border-radius: 40rpx;
			background-image: linear-gradient(to bottom, #2366D5, #001B48);
			font-size: 32rpx;
			color: #E5EFFE;
		}

		.btns {
			position: fixed;
			bottom: 0;
			display: flex;
			width: 100%;
			z-index: 333;

			.btn1 {
				width: 50%;
				height: 96rpx;
				line-height: 96rpx;
				text-align: center;
				font-size: 24rpx;
			}

			.consel {
				background-color: #e9e9e9;
				color: #777;
			}

			.save {
				background-color: #003690;
				color: #fff;
			}
		}

		.btn:active {
			background: rgba(0, 0, 0, 0.4);
		}

		.zhanwei {
			height: 250rpx;
		}

		.record {
			display: flex;
			align-items: center;
			justify-content: space-between;
			color: #003690;
			font-size: 32rpx;
			// padding-top: 20rpx;
			padding: 0rpx 0rpx;
			height: 100rpx;
			align-items: center;
			border-bottom: 1rpx solid #DDDDDD;

			.right {
				width: 394rpx;
				height: 52rpx;
				background: #F2F2F2;
				opacity: 1;
				border-radius: 50rpx;
				padding:  0 10rpx 0 15rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
			}

			image {
				width: 32rpx;
				height: 32rpx;
				margin: 0 20rpx 0 30rpx;
			}

			span {
				font-weight: 700;
			}
		}

		.record-item {
			display: flex;
			justify-content: space-between;
			padding: 10rpx 30rpx;
			border-bottom: 2rpx solid #eee;

			.record-item-left {
				display: flex;
				align-items: center;

				.shu {
					width: 8rpx;
					height: 28rpx;
					background-color: #003690;
					border-radius: 8rpx;
				}

				.title {
					font-size: 32rpx;
					color: #333;
					font-weight: 500;
					margin: 0 10rpx;
				}

				.time {
					font-size: 24rpx;
					color: #777;
				}
			}

			.record-item-right {
				display: flex;
				align-items: center;

				.dianhua {
					width: 28rpx;
					height: 28rpx;
				}

				.zhankai {
					width: 36rpx;
					height: 36rpx;
				}

				.title {
					font-size: 32rpx;
					color: #555;
					font-weight: 500;
					margin: 0 10rpx;
				}
			}
		}

		.supplement {
			margin: 20rpx 24rpx;
			background-color: #fff;
			position: relative;
			overflow: hidden;

			.explain {
				.textArea {
					min-height: 142rpx;
					padding: 14rpx 30rpx;
					font-size: 32rpx;
					text-align: left;
					color: rgba(187, 187, 187, 0.84);
				}
			}

			.suppBottom {
				.danger-img {
					position: relative;
					margin-left: 50rpx;
					margin-bottom: 0rpx;
					width: 68rpx;
					height: 68rpx;
					float: left;

					image {
						width: 36rpx;
						height: 36rpx;
						position: absolute;
						left: 50%;
						top: 50%;
						transform: translate(-50%, -50%);
					}
				}

				.num {
					float: right;
					margin-right: 26rpx;
				}
			}
		}
	}
</style>
